<?php
class IndexController extends AdminController {
	public function indexAction() {
		if (is_file(APP_PATH . '/common/data/update_' . PROVERSION . '.lock')) {$this->error('您已经升级过了,如果想再次升级,请删除文件:' . APP_PATH . '/common/data/update_' . PROVERSION . '.lock');}if ($this->request->isPost()) {
			set_time_limit(0);
			$zym_10 = new SqlModel();if (isset($_POST['d1'])) {$zym_10->run(APP_PATH . '/update/data/' . PROVERSION . '.sql');}if (isset($_POST['d2'])) {$zym_10->run(APP_PATH . '/update/data/myisam.sql');}$this->show('修改系统配置<br/>');
			$zym_11 = (new ConfigModel());
			$zym_11->where(['key' => 'url_dir'])->edit(['value' => $_POST['dir']]);
			$this->show('重建url配置<br/>');
			$zym_12 = $zym_11->where(array('group' => '-2'))->field('title,key,intro,value')->order('ordernum asc')->select();
			$zym_9 = array_column($zym_12, 'value', 'key');
			$zym_11->seturl($zym_9);
			$this->show('重建TKD配置<br/>');
			$zym_14 = $zym_11->where(array('group' => '-1'))->field('title,key,intro,value')->order('ordernum asc')->select();foreach ($zym_14 as $zym_5 => &$zym_15) {if ($zym_15['value']) {$zym_15['value'] = json_decode($zym_15['value'], true);} else { $zym_15['value'] = array('title' => '', 'keywords' => '', 'description' => '');}}$zym_14 = array_column($zym_14, 'value', 'key');
			$zym_11->settkd($zym_14);
			$this->show('重建配置文件<br/>');
			$zym_11->createConfigFile();} else { $this->display();}}public function authorAction() {
		$zym_6 = 0;
		$zym_7 = new NovelSearch_infoModel();
		$zym_8 = new AuthorModel();do {
			$zym_13 = $zym_7->field('id,author')->where(['authorid' => 0])->page($zym_6)->limit(100)->order('id asc')->select();foreach ($zym_13 as $zym_15) {
				$zym_16 = $zym_8->getid($zym_15['author']);
				$zym_7->where(['id' => $zym_15['id']])->update(['authorid' => $zym_16]);}$zym_6++;
			echo '.';
			ob_flush();
			flush();} while (count($zym_13) == 100);}}
?>